/*
    Copyright 2010 Justin Lipton, Jonathan Rosenberg
    
    This file is part of MediaList.

    MediaList is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    MediaList is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with MediaList.  If not, see <http://www.gnu.org/licenses/>.
*/

var xmlhttp;
var glob;

function incProg(user, showid)
{
glob=showid;
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="incProg.php";
url=url+"?user="+user;
url=url+"&showid="+showid;
xmlhttp.onreadystatechange=stateIncProg;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function changeStatus(prev, status, showid)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="changeStatus.php";
url=url+"?prev="+prev;
url=url+"&status="+status;
url=url+"&showid="+showid;
xmlhttp.onreadystatechange=ref;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function ref()
{
if (xmlhttp.readyState==4)
{
document.getElementsByName("here")[0].innerHTML=xmlhttp.responseText;
}
}

function stateIncProg()
{
if (xmlhttp.readyState==4)
{
glob="P"+glob;
document.getElementsByName(glob)[0].innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}